/**
 * @author LQZ QQ 291310887
 * 增删改DAO基础类
 */
package com.sx.core;

import java.sql.Connection;

import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;


public class BaseDao extends SqlMapClientDaoSupport{
	/**
	 * 返回一个Context对象
	 **/
	public Connection getConnection() throws Exception{
		return getDataSource().getConnection();
		
	}
	
	/**
	 *添加
	 *@param object  要添加的对象
	 *@param string  要加入的字符串描述
	 **/
	public Integer addInfo(Object object,String string){
		Integer count = (Integer)getSqlMapClientTemplate().insert(string, object);
	
		return count;
	}
	/**
	 *修改 
	 *@param object  要修改的对象
	 *@param string  要修改的字符串描述
	 **/
	public  boolean updateInfo(Object object,String string){
		int count = getSqlMapClientTemplate().update(string, object);
		if(count>0)
		{
			return true;
		}else{
			return false;
		}
	}
	/**
	 *删除 
	 *@param object  要删除的对象
	 *@param string  要删除的字符串描述
	 **/
	public  boolean delInfo(Object object,String string){
		int count = getSqlMapClientTemplate().delete(string, object);
		if (count>0) {
			return true;
		}else{
			return false;
		}
	}
	
}
